﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

using TravelingWebApp.Models;

namespace TravelingWebApp.Data
{
    public class TravelingContext : IdentityDbContext<User>
    {
        public TravelingContext(DbContextOptions<TravelingContext> options) : base(options)
        {
        }

        public DbSet<User> DbUsers { get; set; }
        public DbSet<Bill> DbBills { get; set; }
        public DbSet<Scenary> DbScenaries { get; set; }
        public DbSet<Route> DbRoutes { get; set; }
        public DbSet<Comment> DbComments { get; set; }
        public DbSet<Anoucement> DbAnoucements { get; set; }
        public DbSet<Guide> DbGuides { get; set; }

        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            builder.Entity<Guide>().HasData(
                new Guide
                {
                    Id = "001",
                    Name = "导游1号",
                    Age = 33,
                    Breifing = "I'm the king of the world",
                    PhoneNumber = "13714248778"
                }, 
                new Guide
                {
                    Id = "002",
                    Name = "Ceqiu",
                    Age = 32,
                    Breifing = "I'm the king of the world",
                    PhoneNumber = "13714248778"
                }
                );
            
            builder.Entity<Scenary>().HasData(
                new Scenary
                {
                    Id = "0000",
                    City = "西安市",
                    Spot = "北新街七贤庄1号",
                    Name = "八路军驻西安办事处",
                    Briefing = "八路军西安办事处也称八路军驻陕办事处，位于陕西省西安市古城内西五路北新街 七贤庄 1号，取魏晋时代\"竹林七贤\"的\"七贤\"二字，院落坐北朝南，共十所，现在建为 八路军西安办事处纪念馆 ",
                    Money = 0
                },
                new Scenary
                {
                    Id = "0001",
                    City = "西安市",
                    Spot = "蓝田县葛牌镇",
                    Name = "鄂豫陕苏维埃政府葛牌镇纪念馆",
                    Briefing = "1935年，红二十五军在葛牌镇创建了长征路上的第一个红色政权——葛牌镇区苏维埃政府，留下了“鄂豫陕省委扩大会议旧址”“葛牌镇区苏维埃政府旧址”和“红二十五军军部旧址”。现建立在旧址上的“葛牌镇区苏维埃政府纪念馆”占地800平方米，展出资料照片400余幅，已成为“陕西省爱国主义教育基地”“西安市廉政建设教育基地”。",
                    Money = 0
                },
                new Scenary
                {
                    Id = "0002",
                    City = "西安市",
                    Spot = "蓝田县九间房镇街子村",
                    Name = "汪锋同志故居",
                    Briefing = "蓝田，是革命前辈汪锋同志的故乡，在汪锋同志诞辰100周年之际，建成了汪锋同志故居纪念馆。位于蓝田县九间房镇街子村后的汪锋同志故居，保护面积380平方米。按照“保护为主、抢救第一、合理利用、加强管理”的工作方针，按照上世纪五十年代当地群众建房的风格，根据汪老家人回忆和村里老先生王乾生提供的汪锋故居平面图，对故居进行了大面积维修。从2008年4月开始到2010年6月，先后完成了汪锋旧居修复、人行道石台阶道路铺设、车行道路水泥路面硬化、院内及周边地面平整、护坡砌体及故居周边绿化建设、厕所修建等工作。2007年1月被蓝田县人民政府公布为近现代革命史迹。",
                    Money = 0
                }
                );

            builder.Entity<Anoucement>().HasData(
                new Anoucement
                {
                    Id = "1",
                    Date = new DateTime(year: 2021, month: 9, day: 10),
                    Title = "调试1",
                    Text = "Testing textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting text"
                },
                new Anoucement
                {
                    Id = "2",
                    Date = new DateTime(year: 2021, month: 9, day: 9),
                    Title = "调试2",
                    Text = "Testing textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting textTesting text"
                }
                );

            
        }

    }
}
